#include "Precompile.h"
#include "Light.h"

namespace Graphics{
	Light::Light(LightType type, bool castShadows):Entity(ET_LIGHT),m_type(type),m_castingShadows(castShadows){
		if(m_castingShadows){
			// Create shadow texture render target
			m_shadowMap = GraphicsFactory::createRenderTarget(GraphicsFactory::createEmptyTexture2D(2048,2048,1,Texture2D::SRS_SHADOWMAP,TF_R32_FLOAT));
			m_lightCamera = QuaternionCameraPtr(new Utility::QuaternionCamera);
		}
	}

	void Light::setDirection(Utility::Math::Vector<> &direction){
		m_direction = direction;
	}

	void Light::setDirectionX(float x){
		m_direction(Utility::Math::_x_,x);
	}

	void Light::setDirectionY(float y){
		m_direction(Utility::Math::_y_,y);
	}

	void Light::setDirectionZ(float z){
		m_direction(Utility::Math::_z_,z);
	}

	void Light::setFalloff(float falloff){
		m_falloff = falloff;
	}

	void Light::setCutoff(float cutoff){
		m_cutoff = cutoff;
	}
}